import { notFound } from "next/navigation";
import { SiteChrome } from "@/components/site-chrome";
import { getDictionary, isLocale, type Locale } from "@/lib/site-content";

export default async function LocaleLayout({
  children,
  params,
}: Readonly<{
  children: React.ReactNode;
  params: Promise<{ locale: string }>;
}>) {
  const { locale } = await params;

  if (!isLocale(locale)) {
    notFound();
  }

  const dictionary = getDictionary(locale as Locale);

  return (
    <SiteChrome dictionary={dictionary} locale={locale}>
      {children}
    </SiteChrome>
  );
}
